var mongoose = require('../common/db');

var comment = new mongoose.Schema({
    movie_id: String,
    username: String,
    context: String,
    check: Boolean
})

comment.statics.findByMovieId = async function (m_id) {
    return await this.find({ movie_id: m_id, check: true }).exec();
};

comment.statics.findAll = function () {
    return this.find({}).exec();
};

var commentModel = mongoose.model('comment', comment);
module.exports = commentModel